package com.lp.article.mapper;

import com.lp.model.entity.article.Comments;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommentMapper {

    //增加评论
    void add(Comments comments);

    //删除评论
    void remove(@Param("id") Long id);

    //根据 id 获取评论信息
    Comments selectCommentById(@Param("id") Long id);

    //根据文章 id 获取评论列表
    List<Comments> selectCommentListByArticleId(@Param("articleId") Long articleId,
                                                @Param("limit") Integer limit,
                                                @Param("offset") Integer offset);

    //通过文章 id 获取评论总数
    Long selectCommentTotalByArticleId(@Param("articleId") Long articleId);

}
